<template>
  <basic-container>
    <!-- 表单 -->
    <el-form
      ref="form"
      :model="formData"
      label-width="80px"
    >
      <el-form-item label="活动名称">
        <dialog-select
          :tableOption="getOption"
          :scope="formData"
        ></dialog-select>
      </el-form-item>
    </el-form>

    <!-- <avue-form
      :option="option"
      v-model="obj"
      @submit="submit"
    >
      <template
        slot-scope="scope"
        slot="input"
      >
        <dialog-select
          :tableOption="getOption"
          :scope="scope"
        ></dialog-select>
      </template>
    </avue-form> -->

  </basic-container>
</template>

<script>
import dialogSelect from '@/components/dialogSelect/main.vue'
export default {
  components: { dialogSelect },
  data() {
    return {
      formData: {
        id: 11,
        name: '例子四',
      },
      // option: {
      //   labelWidth: 110,
      //   column: [{
      //     label: '输入框',
      //     prop: "input1",
      //     span: 12,
      //     row: true
      //   },
      //   {
      //     label: '子表单',
      //     prop: 'dynamic',
      //     type: 'dynamic',
      //     span: 24,
      //     children: {
      //       align: 'center',
      //       headerAlign: 'center',
      //       rowAdd: (done) => {
      //         this.$message.success('新增回调');
      //         done({
      //           input: '默认值'
      //         });
      //       },
      //       rowDel: (row, done) => {
      //         this.$message.success('删除回调' + JSON.stringify(row));
      //         done();
      //       },
      //       // 子表单配置
      //       column: [{
      //         label: '输入框',
      //         prop: "input",
      //         formslot: true,
      //       }]
      //     }
      //   },

      //   ]
      // },
      getOption: {
        callback: this.tableCb,//弹窗里点击确定后的回调
        sigleSelect: true,//单选or多选，默认单选
        column: [{//table列的配置,例prop:'name',label:'姓名'
          label: '姓名',
          prop: 'name',
          search: true,
        }, {
          label: '编码',
          prop: 'id',
          search: false,
          // type:'select',
          // dictData:[{name:'1',id:'1'}]
        }],
        uniqueProp: 'id'//table的唯一值
      }
    }
  },
  methods: {
    tableCb(selectedD, baseScope) {//弹窗里点击确定后的回调
      console.log('')
      console.log('弹窗里点击确定后的回调')
      console.log(selectedD, baseScope)
      this.formData.newName = selectedD.name
      this.formData.newId = selectedD.id
    },
    submit(form, done) {
      done()
      printLog(this.obj)

    }
  }
}
</script>
